package 基础语法;

import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.Properties;

public class Map的properties{
    public static void main(String[] args) throws FileNotFoundException, IOException {
        Properties properties=new Properties();//Properties extends Hashtable<Object,Object>=》 class Hashtable<K,V>  implements Map<K,V>,就是一个Map，Map支持的他都支持
        properties.put("k1", "v1");
        properties.put("k1", "v1");//会依据键去重

        /**
         * 底层：编码用的时ISO，不支持中文
         *   store0(new BufferedWriter(new OutputStreamWriter(out, ISO_8859_1.INSTANCE)),
               comments,
               true);
         * 
        */

        properties.store(new FileOutputStream("./my.properties"), "无");
         properties.store(new FileWriter("./my_writer.properties"), "无");

         properties.load(new FileInputStream("./my.properties"));
         System.out.println(properties);
        
    }
}
